//
//  ZCXFeedbackViewController.m
//  LoveOfPet
//
//  Created by dllo on 15/11/20.
//  Copyright © 2015年 孔维. All rights reserved.
//

#import "ZCXFeedbackViewController.h"
#import <MessageUI/MessageUI.h>
#import <MessageUI/MFMailComposeViewController.h>
@interface ZCXFeedbackViewController ()<MFMailComposeViewControllerDelegate>
#define HEIGHT  [[UIScreen mainScreen]bounds].size.height / 667
#define WIDTH   [[UIScreen mainScreen]bounds].size.width / 375
@end

@implementation ZCXFeedbackViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    
    self.title = @"意见反馈";
    MFMailComposeViewController *mc = [[MFMailComposeViewController alloc] init];
    [mc setMailComposeDelegate:self];
    // 设置邮件主题
    [mc setSubject:@"欢迎用户反馈"];
    //设置收件人
    [mc setToRecipients:@[@"516475711@qq.com"]];
    //设置抄送人
    [mc setCcRecipients:@[@"516475711@qq.com"]];
    //设置邮件文本内容
    NSString *emailContent = @"文本,填入你的意见.";
    //是否是html格式
    [mc setMessageBody:emailContent isHTML:NO];
    // 弹出邮件发送视图
    [self presentViewController:mc animated:YES completion:nil];
    [mc release];
    
}
- (void)mailComposeController:(MFMailComposeViewController*)controller
          didFinishWithResult:(MFMailComposeResult)result
                        error:(NSError*)error {
    switch (result)
    {
            //用户取消编辑
        case MFMailComposeResultCancelled:
            NSLog(@"Mail send canceled1...");
            break;
            //用户保存邮件
        case MFMailComposeResultSaved:
            NSLog(@"Mail saved...");
            break;
            //用户点击发送
        case MFMailComposeResultSent:
            NSLog(@"Mail sent...");
            break;
            //用户尝试保存或者发送邮件失败
        case MFMailComposeResultFailed:
            NSLog(@"Mail send errored: %@...", [error localizedDescription]);
            break;
        default:
            break;
    }
    [self dismissViewControllerAnimated:YES completion:nil];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
